package com.h2.gwt.util.activity;

import com.google.gwt.user.client.Timer;

public abstract class AActivityThresholdTimer extends Timer {
   
   /** Default threshold is 2 minutes. */
   private Integer _threshold = 2 * 60 * 1000;
   
   ////
   ////
   
   public AActivityThresholdTimer() {
      //do nothing
   }
   
   public AActivityThresholdTimer(Integer threshold) {
      setThreshold(threshold);
   }

   @Override
   public void run() {
//      if (ApplicationContext.getInstance().getActivityMonitor()
//            .isUserActive(getThreshold())) {
//         runOnActive();
//      }
   }
   
   public abstract void runOnActive();
   
   /**
    * @return the threshold
    */
   public Integer getThreshold() {
      return _threshold;
   }

   /**
    * @param threshold the threshold to set
    */
   public void setThreshold(Integer threshold) {
      _threshold = threshold;
   }
   
}
